define(['bootstrapTable'],function (bootstrapTable) {
    return{
        init:function () {
            showData();
        }
    };
    function showData(){
        $('#bootstrapTable').bootstrapTable({
            url: "/publicSentimentSearch/pageSelect", // 获取表格数据的url
            method:'post',
            cache: false,       // 设置为 false 禁用 AJAX 数据缓存， 默认为true
            striped: true,      //表格显示条纹，默认为false
            pagination: true,   // 在表格底部显示分页组件，默认false
            pageList: [20,50,100], // 设置页面可以显示的数据条数
            pageSize: 20,       // 页面数据条数
            pageNumber: 1,      // 首页页码
            contentType:'application/x-www-form-urlencoded',
            sidePagination: 'server', // 设置为服务器端分页，必要
            queryParamsType : "",
            sortClass:'actual_ip',
            showColumns:true,
            showToggle:true,
            icons:{
                paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
                paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
                refresh: 'glyphicon-refresh icon-refresh',
                toggle: 'glyphicon-list-alt icon-list-alt',
                columns: 'glyphicon-th icon-th',
                detailOpen: 'glyphicon-plus icon-plus',
                detailClose: 'glyphicon-minus icon-minus'
            },
            queryParams:queryParams,
            idField: "actual_ip",  //标识哪个字段为id主键
            showRefresh: true,  //显示刷新按钮
            search: true,//是否显示右上角的搜索框
            searchAlign:'left',
            sortStable:false,
            columns: [
                {
                    title: '序号',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var options = $('#bootstrapTable').bootstrapTable('getOptions');
                        return options.pageSize * (options.pageNumber - 1) + index + 1;
                    },
                    width:'1%'
                },
                {
                    field: 'actual_ip',
                    title: 'IP',
                    align: 'center',
                    valign: 'middle',
                    width:'15%'

                }, {
                    field: 'content',
                    title: '内容',
                    align: 'center',
                    valign: 'middle',
                    width:'20%'
                }, {
                    field: 'ip_ascription',
                    title: "IP归属地",
                    align: 'center',
                    valign: 'middle',
                    width:'15%'
                },{
                    field:'sourceUrl',
                    title:'访问域名',
                    align:'center',
                    valign:'middle',
                    width:'20%'
                }, {
                    field:'urlType',
                    title: "网站类型",
                    align: 'center',
                    valign: 'middle',
                },
                {
                    field:'urlType',
                    title: "网站类型",
                    align: 'center',
                    valign: 'middle',
                }
            ],
            onLoadSuccess: function(data){  //加载成功时执行
                //console.log(data);
            },
            onLoadError: function(){  //加载失败时执行
                //console.info("加载数据失败");
            }
        });
        function queryParams(params) {
            var temp = {rows:params.pageSize,page:params.pageNumber};
            return temp;
        }
    }
})